//
//  BasesViewController.m
//  tuanGG
//
//  Created by 李洪旭 on 15/9/21.
//  Copyright (c) 2015年 weita. All rights reserved.
//

#import "BasesViewController.h"
#import "TabBarController.h"
#import "Header.h"
#import "DataStatisticsController.h"
#import "AccountCenterController.h"
@interface BasesViewController ()

@end

@implementation BasesViewController

- (instancetype)init
{
    self = [super init];
    if (self) {

        UIBarButtonItem *temporaryBarButtonItem = [[UIBarButtonItem alloc] init];
        temporaryBarButtonItem.title = @"";
        self.navigationItem.backBarButtonItem = temporaryBarButtonItem;
        self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"back"] style:UIBarButtonItemStylePlain target:self action:@selector(backButton:)];



    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
}
//导航栏标题
-(void)addnavigationTitle:(NSString *)titleinfo navColor:(NSString *)string{
    UILabel *title=[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 0, 20)];
    [title setTextColor:[UIColor whiteColor]];
    [title setText:titleinfo];
    title.font = [UIFont boldSystemFontOfSize:18];
    UIColor *color = [UIColor colorWithHexString:string];
    self.navigationController.navigationBar.translucent = NO;
    self.navigationController.navigationBar.barTintColor =color;
    self.navigationItem.titleView=title;
}

- (void)tabBarHidden {
    TabBarController *tabBar= (TabBarController *)self.tabBarController;
    [tabBar hidTabBar];
}
- (void)tabBarShow {
    TabBarController *tabBar= (TabBarController *)self.tabBarController;
    [tabBar showTabBar];
}
- (void)backButton:(UIButton *)sender {
    if ([UserInfo sharedUserInfo].loginStatus == YES ) {
        [self.navigationController popViewControllerAnimated:YES];
    }else {
        [self dismissViewControllerAnimated:YES completion:nil];
    }
}

//提示框
-(void)addAlert:(NSString *)string otherButtonTitles:(NSString *)more{
    UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"温馨提示" message:string delegate:self cancelButtonTitle:@"确定" otherButtonTitles:more, nil];
    [alert show];
}
- (UILabel *)textLabel:(NSString *)string frame:(CGRect)frame location:(NSInteger)number textColor:(UIColor *)textColor textFont:(NSString *)font textFontNumber:(NSInteger)index backgroundColor:(UIColor *)backgroundColor{
    UILabel *label = [[UILabel alloc]initWithFrame:frame];
    switch (number) {
        case 1:label.textAlignment = NSTextAlignmentCenter;break;
        case 2:label.textAlignment = NSTextAlignmentRight;break;
        case 3:label.textAlignment = NSTextAlignmentLeft;break;
        default:
            break;
    }
    label.text = string;
    label.font = [UIFont fontWithName:font size:index];
    label.textColor = textColor;
    label.backgroundColor = backgroundColor;
    [self.view addSubview:label];
    return label;
}
@end
